$(function(){
    var $container = $('#container');

    $container.imagesLoaded( function(){
        $container.masonry({
            itemSelector : '.box'
        });
    });

    $("a[rel=galeria]").fancybox({
        'transitionIn'		: 'elastic',
        'transitionOut'		: 'elastic',
        'padding'               : '7',
        'titlePosition' 	: 'over',
        'overlayColor'          : '#000',
        'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
            return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
        }
    });

});